 <?php   require( dirname(__FILE__) . '/wp-load.php' );   
   /* cheking is user is logged in*/ 
   if ( is_user_logged_in() ) { 
    get_currentuserinfo(); /* getting user details*/

/* sending e-mail to the shop email */
        $to      = 'nestadevil@gmail.com';
        $subject = 'New Order';
        $jcitems =  " Name: " . $current_user->user_lastname .
                    " \n First Name: " . $current_user->user_firstname .
                    " \n Email: " . $current_user->user_email .
                    " \n Phone: " . $current_user->phone .
                    " \n Adress: " . $current_user->adress ;
        $headers = 'From: shop@domain.com' . "\r\n" .
                   'Reply-To: shop@domain.com' . "\r\n" .
                   'X-Mailer: PHP/' . phpversion();
        mail($to, $subject, $jcitems, $headers);

/* sending e-mail with the order to the users email*/        

        $to      = $current_user->user_email;
        $subject = 'Order copy from Domain';
        $jcitems =  "Thank you for your order. Below you have your ordered details".
                    " \n ORDER: \n\n " . $_POST['jcitems'] . "Total: " . $_POST['jctotal'] . " RM" .
                    "\n\n http://rigelonline.blogspot.com \n nestadevil@gmail.com";
        $headers = 'From: nestadevil@gmail.com' . "\r\n" .
                   'Reply-To: nestadevil@gmail.com' . "\r\n" .
                   'X-Mailer: PHP/' . phpversion();
        mail($to, $subject, $jcitems, $headers);
        /*Clearing the cart info after succesfull order is made*/
        setcookie ("simpleCart", "", time() - 3600);
        /*redirecting user to Thank you page from Wordpress*/
    Header('Location: http://rigelonline.blogspot.com/p/terima-kasih.html');  }   ?>